#   Makefile for nr on Linux

SOURCES = svdcmp.c pythag.c svbksb.c nrutil.c
OBJECTS = svdcmp.o pythag.o svbksb.o nrutil.o

TARGET= test
MAIN_S = $(TARGET).c
MAIN_O = $(TARGET).o

# CC = gcc
CC = g++

CFLAGS= -O2 -ansi -pedantic -fPIC -funroll-loops -ffast-math -DSHM
CLIBFLAGS= -shared -Wl,-soname

all: $(TARGET) nr-all.so


$(TARGET) : $(OBJECTS)
	$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(MAIN_S)

$(OBJECTS): $(SOURCES) nrutil.h

# nr-all.o : nr-all.c nrutil.h nr.h

# nr-all : nr-all.o
#	$(CC) $(CFLAGS) -o $@ $(OBJECTS) nr-all.o

# nr-all.so : nr-all.o
#	$(CC) $(CLIBFLAGS) -o $@ nr-all.o

nr-all.so : $(OBJECTS)
	$(CC) $(CLIBFLAGS) -o $@ $(OBJECTS)

.PHONY: clean	
clean:
	rm -f $(OBJECTS) nr-all.so
#	rm -f *.so
#	rm -f *.o

install: 
	mv  $(OBJECTS) nr-all.so /opt/rh/lib

